<?php

include 'uploadpicture.php';
include 'datehelper.php';
include 'db.php';
DB::connect(DB_HOST,DB_USER,DB_PASSWORD,DB_DATABASE);

// include models
include 'model.php';
$handle = opendir(BASE_DIR.'/model'); 
while (false !== ($file = readdir($handle))) { 
    if ($file != "." && $file != ".." && $file!='document.php') { 
        include BASE_DIR."/model/".$file; 
    } 
}
closedir($handle); 

// include utils
include 'utils/Controls.php';
$handle = opendir(BASE_DIR.'/lib/utils'); 
while (false !== ($file = readdir($handle))) { 
    if ($file != "." && $file != ".." && $file!="Controls.php") { 
        include BASE_DIR."/lib/utils/".$file; 
    } 
}
closedir($handle); 

// include modules
$handle = opendir(BASE_DIR.'/modules'); 
while (false !== ($file = readdir($handle))) { 
    if ($file != "." && $file != "..") 
	{ 
		if(is_dir(BASE_DIR.'/modules/'.$file))
		{
			$handle2 = opendir(BASE_DIR.'/modules/'.$file); 
			while (false !== ($file2 = readdir($handle2))) { 
			    if ($file2 != "." && $file2 != "..") 
				{ 
					if( strpos($file2,".php")>0)
					include BASE_DIR."/modules/".$file."/".$file2;
			    } 
			}
			closedir($handle2);
		}
    } 
}
closedir($handle);
